package com.itheima.mybatis.controller;

import com.itheima.mybatis.bean.Student;
import com.itheima.mybatis.service.StudentServiceImpl;
import org.junit.Test;

import java.util.List;

public class StudentController {
    StudentServiceImpl service = new StudentServiceImpl();

    @Test
    public void findAll() {
        List<Student> list = service.findAll();
        for (Student student : list) {
            System.out.println(student);
        }
    }

    @Test
    public void findById() {
        Student stu = service.findById(3);
        System.out.println(stu);
    }

    @Test
    public void insert() {
        Student stu = new Student(4, "偏偏", 22);
        int res = service.insert(stu);
        System.out.println(res);
    }

    @Test
    public void delete() {
        int res = service.delete(4);
        System.out.println(res);
    }

    @Test
    public void update() {
        Student stu = new Student(3, "小尹", 23);
        int res = service.update(stu);
        System.out.println(res);
    }
}
